﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace TeamNitro.Student
{
    public partial class Students_EditProfile : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                DBManager_Jowie dbJowie = (DBManager_Jowie)Session["Student"];
                lblName.Text = dbJowie.Name;
                lblAdminNo.Text = dbJowie.AdminNumber;
                lblSchool.Text = dbJowie.SchoolName;
                lblCurrentCourse.Text = dbJowie.CurrentCourse;
                lblCourseCode.Text = dbJowie.CourseCode;
                lblCurrentSem.Text = dbJowie.CurrentSemester;
                lblCurrentYear.Text = dbJowie.CurrentYear;
                tbxHome.Text = dbJowie.HomeAddress;
                tbxEmail.Text = dbJowie.Email;
                tbxMobile.Text = dbJowie.MobileNumber.ToString();
            }      
        }

        protected void Button1_Click(object sender, EventArgs e)
        {
            DBManager_Jowie dbJowie = new DBManager_Jowie();

            dbJowie.AdminNumber = lblAdminNo.Text;
            dbJowie.HomeAddress = tbxHome.Text;
            dbJowie.Email = tbxEmail.Text;
            dbJowie.MobileNumber = Convert.ToInt32(tbxMobile.Text);
            DBManager_Jowie.UpdateStudentInfo(dbJowie);
        }
    }
}